}
let perfModule;
- const perfModuleName = GLib.getenv('SHELL_PERF_MODULE');
- if (perfModuleName) {
- perfModule = await import(`../perf/${perfModuleName}.js`);
+ const {automationScript} = global;
+ if (automationScript) {
+ perfModule = await import(automationScript.get_uri());
if (perfModule.init)
perfModule.init();
}
def start_shell(wrap=None, perf_output=None):
# Set up environment
env = dict(os.environ)
- env['SHELL_PERF_MODULE'] = options.perf
filters = ['Gnome-shell-perf-helper'] + options.extra_filter
env['MUTTER_WM_CLASS_FILTER'] = ','.join(filters)
args += wrap.split(' ')
args.append(os.path.join(self_dir, 'gnome-shell'))
+ args.append('--automation-script')
+ args.append(options.script)
+
args.append('--force-animations')
if options.replace:
subprocess.check_call(command)
def run_performance_test(wrap=None):
- iters = options.perf_iters
+ iters = options.test_iters
if options.perf_warmup:
iters += 1
# Main program
parser = argparse.ArgumentParser()
-parser.add_argument("--perf",
- help="Specify the name of a performance module to run")
-parser.add_argument("--perf-iters", type=int, metavar="ITERS",
- help="Numbers of iterations of performance module to run",
+parser.add_argument("--script",
+ help="Specify the path to the automation script to run")
+parser.add_argument("--test-iters", type=int, metavar="ITERS",
+ help="Numbers of iterations of the test to run",
default=1)
parser.add_argument("--perf-warmup", action="store_true",
help="Run a dry run before performance tests")
options = parser.parse_args()
-if options.perf == None:
+if options.script == None:
if options.hwtest:
- options.perf = 'hwtest'
+ options.script = 'resource:///org/gnome/shell/perf/hwtest.js'
else:
- options.perf = 'core'
+ options.script = 'resource:///org/gnome/shell/perf/core.js'
if options.extra_filter is None:
options.extra_filter = []
-if options.perf == 'hwtest':
+if options.script == 'hwtest':
options.extra_filter.append('Gedit')
normal_exit = run_performance_test(wrap=options.wrap)
static char *session_mode = NULL;
static int caught_signal = 0;
static gboolean force_animations = FALSE;
+static char *script_path = NULL;
#define DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER 1
#define DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER 4
N_("Force animations to be enabled"),
NULL
},
+ {
+ "automation-script", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_FILENAME,
+ &script_path,
+ N_(""),
+ NULL
+ },
{ NULL }
};
main (int argc, char **argv)
{
g_autoptr (MetaContext) context = NULL;
+ g_autoptr (GFile) automation_script = NULL;
+ g_autofree char *cwd = NULL;
GError *error = NULL;
int ecode = EXIT_SUCCESS;
meta_context_set_gnome_wm_keybindings (context, GNOME_WM_KEYBINDINGS);
init_signal_handlers (context);
+ cwd = g_get_current_dir ();
change_to_home_directory ();
if (session_mode == NULL)
dump_gjs_stack_on_signal (SIGSEGV);
}
+ if (script_path)
+ automation_script = g_file_new_for_commandline_arg_and_cwd (script_path, cwd);
+
/* Initialize the Shell global, including GjsContext
* GjsContext will iterate the default main loop to
* resolve internal modules.
*/
_shell_global_init ("session-mode", session_mode,
"force-animations", force_animations,
+ "automation-script", automation_script,
NULL);
/* Setup Meta _after_ the Shell global to avoid GjsContext
char *userdatadir;
GFile *userdatadir_path;
GFile *runtime_state_path;
+ GFile *automation_script;
ShellWindowTracker *window_tracker;
ShellAppSystem *app_system;
PROP_FRAME_FINISH_TIMESTAMP,
PROP_SWITCHEROO_CONTROL,
PROP_FORCE_ANIMATIONS,
+ PROP_AUTOMATION_SCRIPT,
N_PROPS
};
case PROP_FORCE_ANIMATIONS:
global->force_animations = g_value_get_boolean (value);
break;
+ case PROP_AUTOMATION_SCRIPT:
+ g_set_object (&global->automation_script, g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case PROP_FORCE_ANIMATIONS:
g_value_set_boolean (value, global->force_animations);
break;
+ case PROP_AUTOMATION_SCRIPT:
+ g_value_set_object (value, global->automation_script);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT| G_PARAM_STATIC_STRINGS);
+ props[PROP_AUTOMATION_SCRIPT] =
+ g_param_spec_object ("automation-script",
+ "automation-script",
+ "Automation script to run after startup",
+ G_TYPE_FILE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
+
g_object_class_install_properties (gobject_class, N_PROPS, props);
}
args: [
perf_tool,
'--headless',
- '--perf=@0@'.format(test_name),
+ '--script=@0@/js/perf/@1@.js'.format(meson.project_source_root(), test_name),
options,
],
is_parallel: false,